<?php

namespace app\backend\validate;

use app\common\RootValidate;

class ContentValidate extends RootValidate
{
    protected $rule = [
        'id' => 'require',
        'catId' => 'require',
        'state' => 'require',
        'title' => 'require',
        'sort' => 'require|between:0,255',
        'content' => 'require',
    ];

    protected $message = [
        'id.require' => '内容无效',
        'catId.require' => '请选择栏目',
        'state.require' => '请选择状态',
        'title.require' => '请输入标题',
        'sort.require' => '请输入排序',
        'sort.between' => '内容排序的值应在0-255之间',
        'content.require' => '请输入内容描述',
    ];

    protected $scene = [
        'add' => ['catId', 'state', 'title', 'sort', 'content'],
        'edit' => ['id', 'catId', 'state', 'title', 'sort', 'content'],
    ];
}